<?php
class TCaptchaValidator extends TTemplateControl{
	public function validateCaptchaInput($sender,$param){
		if(!$this->CaptchaImage->isCodeValid($param->Value)) {
			$param->IsValid=false;
			$this->Answer->TextField->TextBox->Text = '';
		}
	}
	public function getAnswer() {
        $this->ensureChildControls();
        return $this->getRegisteredObject('Answer');
    }
	public function getValidator() {
        $this->ensureChildControls();
        return $this->getRegisteredObject('Validator');
    }
	public function getCaptchaImage() {
        $this->ensureChildControls();
        return $this->getRegisteredObject('CaptchaImage');
    }
	public function setSkinID($value){
		$this->Answer->TextField->Label->SkinID = $value;
		$this->Answer->TextField->TextBox->SkinID = $value;
		$this->Answer->Validator->SkinID = $value;
		$this->Validator->SkinID = $value; 
	}
	public function setValidationGroup($value){
		$this->Validator->ValidationGroup=$value;
		$this->Answer->ValidationGroup=$value;
	}
}
